<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="viewport" content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width">

    <title>供应商基本信息</title>
    <link href="../lib/fonts/material-icons.css?family=Material+Icons" rel="stylesheet">
    <link href="../lib/css/animate.min.css" rel="stylesheet">
    <link href="../lib/css/quasar.mat.rtl.min.css" rel="stylesheet" type="text/css">

    <style type="text/css">
      [v-cloak] { display: none; }
      .bdl-secondary-3 { border-left: 3px solid #26a69a }
    </style>
  </head>
  <body>
    <div id="q-supplierBaseInfo" v-cloak>
      <q-card class="bg-white full-width">
        <q-card-main>
          <div class="row justify-start q-pa-sm position-relative" style="border: 2px dotted #e6e6e6">
            <div class="q-px-xs q-py-sm q-mt-sm">
              <img src="../static/img/done.png" alt="" style="width: 90px; height: 90px">
            </div>
            <div style="width: 85%">
              <h6 class="q-ma-md text-primary">
                {{ baseInfoForm.name }} 
                <q-chip 
                  color="positive" 
                  v-if="baseInfoForm.phaseNameShang != null"
                  pointing="left"
                  dense
                  square>{{ baseInfoForm.phaseNameShang }}</q-chip>
                <span v-if="baseInfoForm.phaseNameShang != null" class="text-light q-ml-sm" style="font-size:13px">></span>
                <q-chip 
                  color="positive" 
                  pointing="left"
                  dense
                  square>{{ baseInfoForm.phaseName }}</q-chip>
                <span v-if="baseInfoForm.phaseNameXia != null" class="text-light q-ml-sm" style="font-size:13px">></span>
                <q-chip 
                  color="light" 
                  v-if="baseInfoForm.phaseNameXia != null"
                  pointing="left"
                  dense
                  square>{{ baseInfoForm.phaseNameXia }}</q-chip>
              </h6>
              <p class="q-ml-md row gutter-x-sm">
                <span class="col-lg-4 col-md-6 col-sm-6 col-xs-12 q-mt-sm">
                  成为{{ baseInfoForm.phaseName }}时间：
                  <span class="text-light">{{ baseInfoForm.submiePhaseIdTime }}</span>
                </span>
                <span class="col-lg-4 col-md-6 col-sm-6 col-xs-12 q-mt-sm">
                  最近更新时间：
                  <span class="text-light">{{ baseInfoForm.lastUpdateTime }}</span>
                </span>
                <span class="col-lg-4 col-md-6 col-sm-6 col-xs-12 q-mt-sm">
                  编码：
                  <span class="text-light">{{ baseInfoForm.code }}</span>
                </span>
                <span class="col-lg-4 col-md-6 col-sm-6 col-xs-12 q-mt-sm">
                  注册状态：
                  <q-chip dense color="positive" square>
                    通过
                  </q-chip>
                </span>
              </p>
            </div>
            <!-- <div class="absolute" style="top: 25px; right: 25px">
              <q-btn color="primary" @click="openEditModal(baseInfoForm.mainDataStatus)" size="sm">修改</q-btn>
            </div> -->
          </div>
          <div class="row justify-between gutter-x-sm">
            <div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
              <q-tabs 
                align="left"
                v-model="mainTab" 
                :two-lines="false"
                inverted
                color="primary">
                <q-tab slot="title" name="mainInfo" label="主信息" ></q-tab>

                <q-tab-pane name="mainInfo">
                  <div class="row justify-between">
                    <div>
                      <q-btn v-if="isEditMain" color="primary" @click="openEditModal(baseInfoForm.mainDataStatus)" size="sm">修改</q-btn>
                    </div>
                    <div>
                      审核状态：
                      <q-chip dense color="warning" square v-if="baseInfoForm.mainDataStatus === -1">
                        未提交
                      </q-chip>
                      <q-chip dense color="info" square v-else-if="baseInfoForm.mainDataStatus === 0">
                        未审核（已提交）
                      </q-chip>
                      <q-chip dense color="positive" square v-else-if="baseInfoForm.mainDataStatus === 1">
                        通过
                      </q-chip>
                      <q-chip dense color="negative" square v-else-if="baseInfoForm.mainDataStatus === 2">
                        不通过
                        <q-tooltip>驳回理由：{{ baseInfoForm.mainDataContent }}</q-tooltip>
                      </q-chip>
                      <q-chip dense color="warning" square v-else>
                        获取状态失败
                      </q-chip>
                    </div>
                  </div>
                  <div class="row gutter-x-sm gutter-y-sm q-mt-md q-px-md q-my-sm">
                    <span class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                      公司名称：
                      <span class="text-light">{{ baseInfoForm.name }}</span>
                    </span>
                    <span class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                      统一社会信用代码：
                      <span class="text-light">{{ baseInfoForm.taxId }}</span>
                    </span>
                    <span class="col-lg-6 col-md-6 col-sm-6 col-xs-12 q-mt-md">
                      营业执照：
                      <a :href="downloadUrl" target="_blank" style="text-decoration: none;">{{ downloadName }}</a>
                    </span>
                    <span class="col-lg-6 col-md-6 col-sm-6 col-xs-12 q-mt-md">
                      有效时间：
                      <span class="text-light">{{ baseInfoForm.usefulTime }}</span>
                    </span>
                  </div>
                </q-tab-pane>
              </q-tabs>
              <q-tabs 
                align="left"
                v-model="choosedTab" 
                :two-lines="false"
                inverted
                color="primary">
                <q-tab slot="title" name="baseInfo" label="基本信息" ></q-tab>
                <!-- <q-tab slot="title" name="qualifications" label="资质信息" ></q-tab> -->
                
                <q-tab-pane name="baseInfo">
                  <div class="row justify-between">
                    <div>
                      <q-btn v-if="isEdit" color="primary" @click="clickEdit(baseInfoForm.basicsDataStatus)" size="sm">修改</q-btn>
                      <q-btn v-if="isSubmit"  color="primary" :loading="btnLoading" @click="saveEditBaseInfoHandler" size="sm">提交</q-btn>
                    </div>
                    <div>
                      审核状态：
                      <q-chip dense color="warning" square v-if="baseInfoForm.basicsDataStatus === -1">
                        未提交
                      </q-chip>
                      <q-chip dense color="info" square v-else-if="baseInfoForm.basicsDataStatus === 0">
                        未审核（已提交）
                      </q-chip>
                      <q-chip dense color="positive" square v-else-if="baseInfoForm.basicsDataStatus === 1">
                        通过
                      </q-chip>
                      <q-chip dense color="negative" square v-else-if="baseInfoForm.basicsDataStatus === 2">
                        不通过
                        <q-tooltip>驳回理由：{{ baseInfoForm.basicsDataContent }}</q-tooltip>
                      </q-chip>
                      <q-chip dense color="warning" square v-else>
                        获取状态失败
                      </q-chip>
                    </div>
                  </div>
                  <div class="row gutter-x-sm gutter-y-sm q-mt-sm">
                    <q-field 
                      icon="person"
                      :error="readonly == false? $v.baseInfoForm.legalPerson.$error: false"
                      error-label="企业法人不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('企业法人')"
                        @blur="$v.baseInfoForm.legalPerson.$touch"
                        v-model="baseInfoForm.legalPerson"></q-input>
                    </q-field>
                    <q-field 
                      icon="person"
                      :error="readonly == false? $v.baseInfoForm.col24.$error: false"
                      error-label="法人身份证号不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('法人身份证号')"
                        @blur="$v.baseInfoForm.col24.$touch"
                        v-model="baseInfoForm.col24"></q-input>
                    </q-field>
                    <q-field 
                      icon="person"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('企业英文全称')"
                        v-model="baseInfoForm.col26"></q-input>
                    </q-field>
                    <q-field 
                      icon="person"
                      :error="readonly == false? $v.baseInfoForm.duns.$error: false"
                      error-label="邓白氏编码不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('邓白氏编码')"
                        @blur="$v.baseInfoForm.duns.$touch"
                        v-model="baseInfoForm.duns"></q-input>
                    </q-field>
                    <q-field 
                      icon="group"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('贸易伙伴')"
                        v-model="baseInfoForm.col25"></q-input>
                    </q-field>
                    <q-field 
                      icon="group"
                      :error="readonly == false? $v.baseInfoForm.property.$error: false"
                      error-label="企业性质不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-select
                        :readonly="readonly"  
                        :float-label="$t('企业性质')"
                        :readonly="readonly"
                        :options="propertyOptions"
                        @blur="$v.baseInfoForm.property.$touch"
                        v-model="baseInfoForm.property"></q-select>
                    </q-field>
                    <q-field 
                      icon="group"
                      :error="readonly == false? $v.baseInfoForm.vendorClassify.$error: false"
                      error-label="企业类别不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-select
                        :readonly="readonly"  
                        :float-label="$t('企业类别')"
                        :readonly="readonly"
                        :options="vendorClassifyOptions"
                        @blur="$v.baseInfoForm.vendorClassify.$touch"
                        v-model="baseInfoForm.vendorClassify"></q-select>
                    </q-field>
                    <!-- <q-field 
                      icon="group"
                      :error="readonly == false? $v.baseInfoForm.subjectGroupId.$error: false"
                      error-label="科目组不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-select
                        :readonly="readonly"  
                        :float-label="$t('科目组')"
                        :readonly="readonly"
                        :options="subjectGroupOptions"
                        @blur="$v.baseInfoForm.subjectGroupId.$touch"
                        v-model="baseInfoForm.subjectGroupId"></q-select>
                    </q-field> -->
                    <q-field 
                      icon="code"
                      :error="readonly == false? $v.baseInfoForm.companyId.$error: false"
                      error-label="公司代码不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-select
                        :readonly="readonly"  
                        multiple
                        :float-label="$t('公司代码')"
                        :options="companyIdOptions"
                        @blur="$v.baseInfoForm.companyId.$touch"
                        v-model="baseInfoForm.companyId"></q-select>
                    </q-field>
                    <q-field 
                      icon="search"
                      :error="readonly == false? $v.baseInfoForm.shortName.$error: false"
                      error-label="公司代码不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('企业简称')"
                        @blur="$v.baseInfoForm.shortName.$touch"
                        v-model="baseInfoForm.shortName"></q-input>
                    </q-field>
                    <q-field 
                      icon="location_on"
                      :error="readonly == false? $v.baseInfoForm.country.$error: false"
                      error-label="国家不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-select
                        :readonly="readonly"  
                        :float-label="$t('国家')"
                        filter
                        :options="countryOptions"
                        @blur="$v.baseInfoForm.country.$touch"
                        v-model="baseInfoForm.country"></q-select>
                    </q-field>
                    <q-field 
                      :error="readonly == false? $v.baseInfoForm.province.$error: false"
                      error-label="省份不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-select
                        :readonly="readonly"  
                        :float-label="$t('省份')"
                        filter
                        :options="provinceOptions"
                        @blur="$v.baseInfoForm.province.$touch"
                        v-model="baseInfoForm.province"></q-select>
                    </q-field>
                    <q-field 
                      :error="readonly == false? $v.baseInfoForm.city.$error: false"
                      error-label="城市不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-select
                        :readonly="readonly"  
                        :float-label="$t('城市')"
                        filter
                        :options="cityOptions"
                        @blur="$v.baseInfoForm.city.$touch"
                        v-model="baseInfoForm.city"></q-select>
                    </q-field>
                    <q-field 
                      icon="home"
                      :error="readonly == false? $v.baseInfoForm.address.$error: false"
                      error-label="地址（街道）不能为空"
                      class="col-lg-8 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('地址（街道）')"
                        @blur="$v.baseInfoForm.address.$touch"
                        v-model="baseInfoForm.address"></q-input>
                    </q-field>
                    <q-field 
                      icon="email"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('邮箱')"
                        type="email"
                        v-model="baseInfoForm.email"></q-input>
                    </q-field>
                    <q-field 
                      icon="contact_mail"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('邮编')"
                        type="number"
                        v-model="baseInfoForm.postCode"></q-input>
                    </q-field>
                    <q-field 
                      icon="call"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('电话')"
                        v-model="baseInfoForm.phone"></q-input>
                    </q-field>
                    <q-field 
                      icon="stay_primary_portrait"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('手机')"
                        type="number"
                        v-model="baseInfoForm.mobilePhone"></q-input>
                    </q-field>
                    <q-field 
                      icon="local_printshop"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('传真')"
                        v-model="baseInfoForm.fax"></q-input>
                    </q-field>
                    <q-field 
                      icon="person"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('联系人')"
                        v-model="baseInfoForm.contacts"></q-input>
                    </q-field>
                    <q-field 
                      icon="person"
                      :error="readonly == false? $v.baseInfoForm.managerContact.$error: false"
                      error-label="总经理联系人不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('总经理联系人')"
                        @blur="$v.baseInfoForm.managerContact.$touch"
                        v-model="baseInfoForm.managerContact"></q-input>
                    </q-field>
                    <q-field 
                      icon="call"
                      :error="readonly == false? $v.baseInfoForm.managerTelephone.$error: false"
                      :error-label="$v.baseInfoForm.managerTelephone.required? ($v.baseInfoForm.managerTelephone.mustNumber? '': '必须为数字'): '不能为空'"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('总经理联系电话')"
                        @blur="$v.baseInfoForm.managerTelephone.$touch"
                        v-model="baseInfoForm.managerTelephone"></q-input>
                    </q-field>
                    <q-field 
                      icon="person"
                      :error="readonly == false? $v.baseInfoForm.salesDirector.$error: false"
                      error-label="销售总监联系人不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('销售总监联系人')"
                        @blur="$v.baseInfoForm.salesDirector.$touch"
                        v-model="baseInfoForm.salesDirector"></q-input>
                    </q-field>
                    <q-field 
                      icon="call"
                      :error="readonly == false? $v.baseInfoForm.salesDirectorTelephone.$error: false"
                      :error-label="$v.baseInfoForm.salesDirectorTelephone.required? ($v.baseInfoForm.salesDirectorTelephone.mustNumber? '': '必须为数字'): '不能为空'"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('销售总监联系电话')"
                        @blur="$v.baseInfoForm.salesDirectorTelephone.$touch"
                        v-model="baseInfoForm.salesDirectorTelephone"></q-input>
                    </q-field>
                    <q-field 
                      icon="person"
                      :error="readonly == false? $v.baseInfoForm.col29.$error: false"
                      error-label="物料分类不能为空"
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        ref="meterialType"
                        :readonly="readonly"  
                        :float-label="$t('物料分类')"
                        @click="focusOpenTree"
                        @blur="$v.baseInfoForm.col29.$touch"
                        v-model="baseInfoForm.col29"></q-input>
                    </q-field>
                  </div>
                </q-tab-pane>
                <!-- <q-tab-pane name="qualifications">
                  <div class="row gutter-x-sm gutter-y-sm q-mt-sm">
                    <q-field 
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('组织机构代码证编码')"
                        v-model="qualificationsForm.graf1"></q-input>
                    </q-field>
                    <q-field 
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('营业执照编码')"
                        v-model="qualificationsForm.graf2"></q-input>
                    </q-field>
                    <q-field 
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-input
                        :readonly="readonly"  
                        :float-label="$t('税务登记证编码')"
                        v-model="qualificationsForm.graf3"></q-input>
                    </q-field>
                    <q-field 
                      class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                      <q-uploader 
                        color="secondary" 
                        name="files"
                        @uploaded="uploaded"
                        :headers="{'Accept': 'application/json;charset=utf-8'}"
                        stack-label="资质上传" 
                        url="uploadUrl" ></q-uploader>
                    </q-field>
                  </div>
                </q-tab-pane> -->
              </q-tabs>
            </div>
            <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
              <q-tabs 
                align="left"
                v-model="questionTab" 
                :two-lines="false"
                inverted
                no-pane-border
                color="primary">
                <q-tab slot="title" name="question" label="调查表" ></q-tab>

                <q-tab-pane name="question">
                  <div class="q-mb-sm">
                    <q-btn 
                      color="primary" 
                      @click="questionChange" 
                      size="sm">发起变更</q-btn>
                  </div>
                  <q-list v-if="questionList.length > 0">
                    <q-collapsible 
                      v-for="item in questionList"
                      :key="item.id"
                      opened 
                      group="somegroup" 
                      icon="format_list_bulleted" 
                      :label="item.name">
                      <div class="row justify-start gutter-x-sm gutter-y-xs">
                        <div 
                          style="width: 80px; height:100px; text-align: center" 
                          v-for="question in item.csdata"
                          :key="question.id"
                          @click="openQuestionModal(question.id, question.name)"
                          class="relative-position cursor-pointer">
                          <q-icon 
                            name="description" 
                            color="primary" 
                            size="50px"></q-icon>
                          <q-icon 
                            class="absolute"
                            style="right:0 ; top: 2px"
                            :name="question.taskStatus == '-1'? 'fiber_manual_record':question.taskStatus == '0'? 'border_color':question.taskStatus == '1'? 'done': 'backspace'" 
                            :color="question.taskStatus == '-1'? 'light':question.taskStatus == '0'? 'info':question.taskStatus == '1'? 'positive': 'negative'"
                            size="18px">
                            <q-tooltip v-if="question.taskStatus == '2'">驳回理由：{{ question.approvalContent }}</q-tooltip>
                          </q-icon>
                          <p style="font-size: 12px; color:#bdbdbd">{{ question.name }}</p>
                        </div>
                      </div>
                    </q-collapsible>
                  </q-list>
                  <q-list v-else class="q-pl-md">暂无调查表</q-list>
                </q-tab-pane>
              </q-tabs>
            </div>
          </div>
        </q-card-main>
      </q-card>
      <q-modal no-backdrop-dismiss v-model="editModal" :content-css="{minWidth: '90vw', minHeight: '550px',borderRadius: '4px'}">
        <q-modal-layout>
          <q-toolbar slot="header" color="white">
            <q-toolbar-title class="text-dark">
              {{ $t("编辑") }}
            </q-toolbar-title>
            <q-btn flat @click="editModal = false">
              <q-icon name="close" color="dark"></q-icon>
            </q-btn>
          </q-toolbar>
          <q-card class="q-px-md q-py-sm bg-white no-shadow full-width">
            <p class="q-mb-none bdl-secondary-3 q-py-xs q-px-sm">信息类</p>
            <q-card-main class="row gutter-x-md gutter-y-sm">
              <q-field 
                :error="$v.editForm.name.$error"
                error-label="名称为必填项"
                class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                <q-input
                  :readonly="baseInfoForm.mainDataStatus == 0? true: !baseInfoForm.visModifyName"  
                  :float-label="$t('名称')"
                  @blur="$v.editForm.name.$touch"
                  v-model="editForm.name"></q-input>
              </q-field>
            </q-card-main>
            <p class="q-mb-none bdl-secondary-3 q-py-xs q-px-sm">证件类</p>
            <q-card-main class="row gutter-x-md gutter-y-sm">
              <q-field 
                :error="$v.editForm.taxId.$error"
                error-label="统一社会信用代码为必填项"
                class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                <q-input
                  :float-label="$t('统一社会信用代码')"
                  @blur="$v.editForm.taxId.$touch"
                  v-model="editForm.taxId"></q-input>
              </q-field>
              <q-field 
                :error="$v.editForm.usefulTime.$error"
                error-label="证件有效时间为必填项"
                class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                <q-datetime
                  type="date"
                  format="YYYY-MM-DD"
                  format-model="string"
                  :float-label="$t('证件有效时间')"
                  @blur="$v.editForm.usefulTime.$touch"
                  v-model="editForm.usefulTime"></q-datetime>
              </q-field>
              <q-field 
                class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                <q-uploader 
                  ref="businessLic1"
                  color="secondary" 
                  name="files"
                  auto-expand
                  hide-upload-button
                  @add="$refs['businessLic1'].upload()"
                  @uploaded="uploaded1"
                  :headers="{'Accept': 'application/json;charset=utf-8'}"
                  stack-label="营业执照" 
                  :url="uploadUrl" ></q-uploader>
              </q-field>
              <q-field 
                class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                <q-btn color="secondary">
                  <a :href="downloadUrl" target="_blank" style="text-decoration: none; color: white">{{ downloadName }}</a>
                </q-btn>
              </q-field>
            </q-card-main>
            <p v-if="baseInfoForm.mainDataStatus == '1'" class="q-mb-none bdl-secondary-3 q-py-xs q-px-sm">变更类</p>
            <q-card-main v-if="baseInfoForm.mainDataStatus == '1'" class="row gutter-x-md gutter-y-sm">
              <q-field 
                class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                <q-uploader 
                  ref="fileChange"
                  color="secondary" 
                  name="files"
                  auto-expand
                  hide-upload-button
                  @add="$refs['fileChange'].upload()"
                  @uploaded="fileChangeUploaded"
                  :headers="{'Accept': 'application/json;charset=utf-8'}"
                  stack-label="变更文件" 
                  :url="uploadUrl" ></q-uploader>
              </q-field>
              <q-field 
                :error="$v.editForm.col23.$error"
                error-label="变更理由不能为空"
                class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <q-input
                  :float-label="$t('变更理由')"
                  type="textarea"
                  :max-height="100"
                  rows="4"
                  @blur="$v.editForm.col23.$touch"
                  v-model="editForm.col23"></q-input>
              </q-field>
            </q-card-main>
          </q-card>
          <q-toolbar slot="footer" color="white" class="row justify-end">
            <q-btn
              flat
              color="primary"
              @click="editModal = false">{{$t("取消")}}</q-btn>
            <q-btn
              flat
              :loading="btnLoading"
              color="primary"
              @click="saveEditHandler">{{$t("保存")}}</q-btn>
          </q-toolbar>
        </q-modal-layout>
      </q-modal>
      <q-modal no-backdrop-dismiss v-model="editNotAllowedModal" :content-css="{minWidth: '90vw', minHeight: '550px',borderRadius: '4px'}">
        <q-modal-layout>
          <q-toolbar slot="header" color="white">
            <q-toolbar-title class="text-dark">
              {{ $t("编辑") }}
            </q-toolbar-title>
            <q-btn flat @click="editNotAllowedModal = false">
              <q-icon name="close" color="dark"></q-icon>
            </q-btn>
          </q-toolbar>
          <q-card class="q-px-md q-py-sm bg-white no-shadow full-width">
            <p class="q-mb-none bdl-secondary-3 q-py-xs q-px-sm">信息类</p>
            <q-card-main class="row gutter-x-md gutter-y-sm">
              <q-field 
                :error="$v.editNotAllowedForm.name.$error"
                error-label="名称为必填项"
                class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                <q-input
                  :readonly="baseInfoForm.mainDataStatus == 0? true: !baseInfoForm.visModifyName"  
                  :float-label="$t('名称')"
                  @blur="$v.editNotAllowedForm.name.$touch"
                  v-model="editNotAllowedForm.name"></q-input>
              </q-field>
            </q-card-main>
            <p class="q-mb-none bdl-secondary-3 q-py-xs q-px-sm">证件类</p>
            <q-card-main class="row gutter-x-md gutter-y-sm">
              <q-field 
                :error="$v.editNotAllowedForm.taxId.$error"
                error-label="统一社会信用代码为必填项"
                class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                <q-input
                  :float-label="$t('统一社会信用代码')"
                  @blur="$v.editNotAllowedForm.taxId.$touch"
                  v-model="editNotAllowedForm.taxId"></q-input>
              </q-field>
              <q-field 
                :error="$v.editNotAllowedForm.usefulTime.$error"
                error-label="证件有效时间为必填项"
                class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                <q-datetime
                  type="date"
                  format="YYYY-MM-DD"
                  format-model="string"
                  :float-label="$t('证件有效时间')"
                  @blur="$v.editNotAllowedForm.usefulTime.$touch"
                  v-model="editNotAllowedForm.usefulTime"></q-datetime>
              </q-field>
              <q-field 
                class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                <q-uploader 
                  ref="businessLic"
                  color="secondary" 
                  name="files"
                  auto-expand
                  hide-upload-button
                  @add="$refs['businessLic'].upload()"
                  @uploaded="uploaded"
                  :headers="{'Accept': 'application/json;charset=utf-8'}"
                  stack-label="营业执照" 
                  :url="uploadUrl" ></q-uploader>
              </q-field>
              <q-field 
                class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                <q-btn color="secondary">
                  <a :href="downloadUrl" target="_blank" style="text-decoration: none; color: white">{{ downloadName }}</a>
                </q-btn>
              </q-field>
            </q-card-main>
          </q-card>
          <q-toolbar slot="footer" color="white" class="row justify-end">
            <q-btn
              flat
              color="primary"
              @click="editNotAllowedModal = false">{{$t("取消")}}</q-btn>
            <q-btn
              flat
              :loading="btnLoading"
              color="primary"
              @click="saveEditHandler">{{$t("保存")}}</q-btn>
          </q-toolbar>
        </q-modal-layout>
      </q-modal>
      <q-modal no-backdrop-dismiss v-model="questionsModal" :content-css="{minWidth: '100vw', minHeight: '100%',borderRadius: '4px'}">
        <q-modal-layout>
          <q-toolbar slot="header" color="white">
            <q-toolbar-title class="text-dark">
              {{ questionCurrentClick }}
            </q-toolbar-title>
            <q-btn flat @click="questionsModal = false">
              <q-icon name="close" color="dark"></q-icon>
            </q-btn>
          </q-toolbar>
          <iframe v-if="questionsModal" :src="whichQuestion" frameborder="0" style="width: 100%;height: 98%"></iframe>
        </q-modal-layout>
      </q-modal>
      <q-modal no-backdrop-dismiss v-model="meterialTreeModal" :content-css="{minWidth: '70vw', minHeight: '80%',borderRadius: '4px'}">
        <q-modal-layout>
          <q-toolbar slot="header" color="white">
            <q-toolbar-title class="text-dark">
              {{ $t("物料分类") }}
            </q-toolbar-title>
            <q-btn flat @click="meterialTreeModal = false">
              <q-icon name="close" color="dark"></q-icon>
            </q-btn>
          </q-toolbar>
          <div>
            <q-tree
              class="q-mt-md tree-styl"
              color="secondary"
              :nodes="meterialLevelData"
              node-key="value"
              :filter="searchNodes"
              no-results-label="没有找到结果"
              :expanded.sync="expandedNodes"
              :selected.sync="nodeSelected"
              tickable
              tick-strategy="leaf"
              :ticked.sync="nodeTicked"
            ></q-tree>
          </div>
          <q-toolbar slot="footer" color="white" class="row justify-end">
            <q-btn
              flat
              color="primary"
              @click="meterialTreeModal = false">{{$t("取消")}}</q-btn>
            <q-btn
              flat
              :loading="btnLoading"
              color="primary"
              @click="saveChooseMeterialHandler">{{$t("保存")}}</q-btn>
          </q-toolbar>
        </q-modal-layout>
      </q-modal>
      <!-- 变更 -->
      <q-modal no-backdrop-dismiss v-model="questionChangeModal" :content-css="{minWidth: '50vw', minHeight: '60%',borderRadius: '4px'}">
        <q-modal-layout>
          <q-toolbar slot="header" color="white">
            <q-toolbar-title class="text-dark">
              {{ $t("变更") }}
            </q-toolbar-title>
            <q-btn flat @click="questionChangeModal = false">
              <q-icon name="close" color="dark"></q-icon>
            </q-btn>
          </q-toolbar>
          <q-card class="q-px-md q-py-sm bg-white no-shadow full-width">
            <q-card-main class="row justify-center">
              <q-field 
                :error="$v.questionChangeForm.questionIds.$error"
                error-label="调查表为必选项"
                class="col-lg-10 col-md-10 col-sm-12 col-xs-12">
                <q-select
                  multiple
                  :float-label="$t('调查表')"
                  :options="questionAllOptions"
                  @blur="$v.questionChangeForm.questionIds.$touch"
                  v-model="questionChangeForm.questionIds"></q-select>
              </q-field>
            </q-card-main>
          </q-card>
          <q-toolbar slot="footer" color="white" class="row justify-end">
            <q-btn
              flat
              color="primary"
              @click="questionChangeModal = false">{{$t("取消")}}</q-btn>
            <q-btn
              flat
              :loading="btnLoading"
              color="primary"
              @click="questionChangeConfirm">{{$t("确认")}}</q-btn>
          </q-toolbar>
        </q-modal-layout>
      </q-modal>
    </div>
    
    <!-- ie-polyfill 、 vue.js and quasar-framework -->
    <script src="../lib/js/quasar.ie.polyfills.umd.min.js"></script>
    <script src="../lib/js/vue.js"></script>
    <script src="../lib/js/quasar.mat.umd.min.js"></script>
    <!-- babel for es6 transform -->
    <!-- <script src="lib/js/babel.min.js"></script> -->
    <!-- vue validate -->
    <script src="../lib/js/vuelidate.min.js"></script>
    <script src="../lib/js/validators.min.js"></script>
    <!-- consts ps: always leave this file first -->
    <script src="../script/consts.js"></script>
    <!-- status code -->
    <script src="../script/status.code.js"></script>
    <!-- qs for axios -->
    <script src="../lib/js/qs.min.js"></script>
    <!-- axios for http request -->
    <script src="../lib/js/axios.js"></script>
    <!-- axios.instance must be after axios -->
    <script src="../script/axios.instance.js"></script>
    <!-- quasar i18n zh-hans -->
    <script src="../lib/lang/zh-hans.js"></script>
    <!-- vue-i18n for application's internationalization -->
    <script src="../lib/js/vue-i18n.js"></script>
    <!-- current page international file -->
    <script src="../lang/sop/supplierBaseInfo.js"></script>
    <script>
      // quasar components use
      Quasar.i18n.set(Quasar.i18n[LANGUGE])

      Vue.use(window.vuelidate.default)
      var minLength = window.validators.minLength
      var required = window.validators.required
      var email = window.validators.email
      var helpers = window.validators.helpers
      var mustNumber = function(value) {
        return /^[0-9]+$/.test(value) || !helpers.req(value)
      }
      var supplierInvite = new Vue({
        el: '#q-supplierBaseInfo',
        i18n: i18n,
        data: function() {
          return {
            mtreeById: '',
            orgId: '',
            uploadUrl: baseURL + '/manager/apqp/index/uploadOperateNew',
            // 基本信息
            choosedTab: 'baseInfo', // 默认选中的tab
            mainTab: 'mainInfo',
            questionTab: 'question',
            currentSupplierId: '',  // 当前供应商ID
            editOrSvae: 'edit',
            readonly: false,
            isEdit: false,
            isSubmit: false,
            isEditMain: false,
            baseInfoForm: {
              // name: '测试供应商 - 1',    // 供应商名称
              legalPerson: '',          // 企业法人
              col24: '',                // 法人身份证号
              col26: '',                // 企业英文全称
              duns: '',                 // 邓白氏码
              col25: '',                // 贸易伙伴
              property: '',             // 企业性质
              vendorClassify: '',       // 企业类别
              subjectGroup: '',       // 科目组
              companyId: [],            // 公司代码
              country: '',              // 国家
              province: '',             // 省份
              city: '',                 // 城市
              address: '',              // 街道
              shortName: '',            // 企业简称
              postCode: '',             // 邮编
              phone: '',                // 电话
              mobilePhone: '',          // 手机
              fax: '',                  // 传真
              // email: '',                // 邮箱
              contacts: '',             // 联系人
              postCode: '',             // 邮编
              managerContact: '',       // 总经理联系人
              managerTelephone: '',     // 总经理联系电话
              salesDirector: '',         // 销售总监联系人
              salesDirectorTelephone: '',// 销售总监联系电话
              // taxId: '',                // 税号
              name: '',
              phaseName: '',
              phaseNameShang: '',
              phaseNameXia: '',
              email: '',
              taxId: '',
              lastUpdateTime: '',
              mainDataStatus: '',
              mainDataContent: '',
              code: '',
              basicsDataStatus: '',      // 基本信息状态
              basicsDataContent: '',
              col28: '',  // 所选物料ids
              col29: '',   // 所选物料名称
              usefulTime: '',
              visModifyName: '',
              submiePhaseIdTime: ''  // 成为当前阶段时间
            },
            vendorClassifyOptions: [
              {
                label: '有限责任公司',
                value: '1'
              },
              {
                label: '股份制公司',
                value: '2'
              },
              {
                label: '集团公司',
                value: '3'
              },
              {
                label: '一人制公司',
                value: '4'
              }
            ],
            propertyOptions: [
              {
                label: '国有企业',
                value: '1'
              },
              {
                label: '国有控股企业',
                value: '2'
              },
              {
                label: '外资企业',
                value: '3'
              },
              {
                label: '合资企业',
                value: '4'
              },
              {
                label: '私营企业',
                value: '5'
              }
            ],
            countryOptions: [
              {
                label: '中国',
                value: 49
              }
            ],  // 国家数据
            provinceOptions: [],  // 省份数据
            cityOptions: [],  // 城市数据
            subjectGroupOptions: [], // 科目组数据
            companyIdOptions: [], // 公司代码 数据
            editModal: false,
            editNotAllowedModal: false,
            btnLoading: false,
            editForm: {
              name: '',
              taxId: '',
              usefulTime: '',
              sysFileName: '',
              sysFileType: '',
              fileUrl: '',
              userFileName: '',
              userFileType: '',
              col23: '', // 变更理由
              usefulTimex: '2050-09-02 00:00:00',
              sysFileNamex: '',
              sysFileTypex: '',
              fileUrlx: '',
              userFileNamex: '',
              userFileTypex: ''
            },
            editNotAllowedForm: {
              name: '',
              taxId: '',
              usefulTime: '',
              sysFileName: '',
              sysFileType: '',
              fileUrl: '',
              userFileName: '',
              userFileType: ''
            },
            downloadUrl: '', // 下载地址
            downloadName: '', // 文件名称
            questionsModal: false,
            whichQuestion: '',
            questionCurrentClick: '', // 当前点击的调查表名称
            questionList: [
            ],  // 调查表数据
            // 资质信息
            qualificationsForm: {
              graf1: '',
              graf2: '',
              graf3: ''
            },
            meterialTreeModal: false,  // 物料tree modal
            meterialLevelData: [],
            expandedNodes: [],
            nodeSelected: '',
            searchNodes:'',
            nodeTicked: [],
            // 调查表变更
            questionChangeForm: {
              questionIds: []
            },
            questionAllOptions: [],
            questionChangeModal: false
          }
        },
        validations: {
          editForm: {
            name: { required: required },
            taxId: { required: required },
            usefulTime: { required: required },
            col23: { required: required }
          },
          editNotAllowedForm: {
            name: { required: required },
            taxId: { required: required },
            usefulTime: { required: required }
          },
          baseInfoForm: {
            legalPerson: { required: required },
            col24: { required: required },
            duns: { required: required },
            shortName: { required: required },
            property: { required: required },
            vendorClassify: { required: required },
            // subjectGroupId: { required: required },
            country: { required: required },
            province: { required: required },
            city: { required: required },
            address: { required: required },
            email: { required: required, email: email },
            companyId: { required: required },
            managerContact: { required: required },
            managerTelephone: { required: required, mustNumber: mustNumber },
            salesDirector: { required: required },
            salesDirectorTelephone: { required: required, mustNumber: mustNumber },
            col29: { required: required },
          },
          // 调查表变更
          questionChangeForm: {
            questionIds: { required: required }
          }
        },
        computed: {
     
        },
        created: function() {
          // this.getCountryData()
          this.getInfo()
          this.getQuestionList()
          this.getSubjectGroupData()
          this.getCodeData()
        },
        watch: {
          'baseInfoForm.country': function(country) {
            this.getProvinceData(country)
          },
          'baseInfoForm.province': function(province) {
            this.getCityData(province)
          },
          'baseInfoForm.col28': function(col28) {
            if (col28 == null || col28 == undefined || col28 == '') {
              this.nodeTicked = []
            } else {
              this.nodeTicked = col28.split(',')
            }
          },
          'baseInfoForm.mainDataStatus': function(mainDataStatus) {
            if (mainDataStatus == '-1' || mainDataStatus == '1' || mainDataStatus == '2') {
              this.isEditMain = true
            } else {
              this.isEditMain = false
            }
          },
          'baseInfoForm.basicsDataStatus': function(basicsDataStatus) {
            if (basicsDataStatus == '1' || basicsDataStatus == '2') {
              this.readonly = true 
              this.isSubmit = false
              this.isEdit = true
            }
            if (basicsDataStatus == '-1') {
              this.readonly = false 
              this.isSubmit = true
              this.isEdit = false
            }
            if (basicsDataStatus == '0') {
              this.readonly = true 
              this.isSubmit = false
              this.isEdit = false
            }
          },
          questionsModal: function(questionsModal) {
            if (questionsModal == false) {
              this.getQuestionList()
            }
          }
        },
        methods: {
          // 首屏数据
          getInfo: function() {
            var that = this
            axios({
              method: 'post',
              url: '/manager/new/vendor/baseInfoNew/vendorQueryVendorBaseInfo'
            })
            .then(function(data) {
              if (data.statusCode == 200) {
                var _companyIds = []
                if (data.single.companyId != null || data.single.companyId != undefined) {
                  _companyIds = data.single.companyId.split(',')
                }
                that.currentSupplierId = data.single.id
                that.mTreeById = data.single.mtreeById
                if (data.single.fileUrl != null && data.single.userFileName != null) {
                  var _filename = encodeURI(encodeURIComponent(data.single.fileUrl.split('.')[0]))
                  that.downloadUrl = baseURL + '/common/download/' + _filename + '/' + data.single.fileUrl.split('.')[1]
                  that.downloadName = data.single.userFileName
                } else {
                  that.downloadUrl = 'javascript:;'
                  that.downloadName = '暂无附件'
                }
                that.baseInfoForm = {
                  legalPerson: data.single.legalPerson,          // 企业法人
                  col24: data.single.col24,                // 法人身份证号
                  col26: data.single.col26,                // 企业英文全称
                  duns: data.single.duns,                 // 邓白氏码
                  col25: data.single.col25,                // 贸易伙伴
                  property: data.single.property,             // 企业性质
                  vendorClassify: data.single.vendorClassify,       // 企业类别
                  companyId: _companyIds,            // 公司代码
                  country: data.single.country,              // 国家
                  province: data.single.province,             // 省份
                  city: data.single.city,                 // 城市
                  address: data.single.address,              // 街道
                  shortName: data.single.shortName,      // 企业简称
                  postCode: data.single.postCode,             // 邮编
                  phone: data.single.phone,                // 电话
                  mobilePhone: data.single.mobilePhone,          // 手机
                  fax: data.single.fax,                  // 传真
                  contacts: data.single.contacts,             // 联系人
                  postCode: data.single.postCode,             // 邮编
                  managerContact: data.single.managerContact,       // 总经理联系人
                  managerTelephone: data.single.managerTelephone,     // 总经理联系电话
                  salesDirector: data.single.salesDirector,         // 销售总监联系人
                  salesDirectorTelephone: data.single.salesDirectorTelephone,// 销售总监联系电话
                  name: data.single.name,
                  phaseName: data.single.phaseName,
                  phaseNameShang: data.single.phaseNameShang,
                  phaseNameXia: data.single.phaseNameXia,
                  email: data.single.email,
                  taxId: data.single.taxId,
                  lastUpdateTime: data.single.lastUpdateTime,
                  mainDataStatus: data.single.mainDataStatus,
                  mainDataContent: data.single.mainDataContent,
                  code: data.single.code,
                  basicsDataStatus: data.single.basicsDataStatus,
                  basicsDataContent: data.single.basicsDataContent,
                  col28: data.single.col28,
                  col29: data.single.col29,
                  usefulTime: data.single.usefulTime,
                  visModifyName: data.single.visModifyName,
                  submiePhaseIdTime: data.single.submiePhaseIdTime
                }
                that.orgId = data.single.orgId
              } else {
                that.$q.notify({
                  message: that.$t(STATUS_CODE[data.statusCode]),
                  icon: 'error_outline',
                  type: 'negative',
                  position: 'top-right'
                })
              }
            })
            .catch(function(err) {
              console.log(err)
            })
          },
          // 调查表
          getQuestionList: function() {
            var that = this
            axios({
              method: 'post',
              url: '/manager/new/vendor/baseInfoNew/vendorQueryQuestionnaire'
            })
            .then(function(data) {
              if (data.statusCode == 200) {
                that.questionList = data.rows
              } else {
                that.$q.notify({
                  message: that.$t(STATUS_CODE[data.statusCode]),
                  icon: 'error_outline',
                  type: 'negative',
                  position: 'top-right'
                })
              }
            })
            .catch(function(err) {
              console.log(err)
            })
          },
          openQuestionModal: function(id, name) {
            // var that = this
            // axios({
            //   method: 'post',
            //   url: '/manager/new/vendor/baseInfoNew/produceForm',
            //   data: {
            //     id: id
            //   }
            // })
            // .then(function(data) {
            //   if (data.statusCode == 200) {
                this.questionCurrentClick = name
                this.whichQuestion = './lookRegisterBaseInfo.html?id=' + id
                this.questionsModal = true
                
            //   } else {
            //     that.$q.notify({
            //       message: that.$t(STATUS_CODE[data.statusCode]),
            //       icon: 'error_outline',
            //       type: 'negative',
            //       position: 'top-right'
            //     })
            //   }
            // })
            // .catch(function(err) {
            //   console.log(err, '获取调查表详情时捕获异常')
            // })
          },
          // 获取国家数据
          // getCountryData: function() {
          //   var that = this
          //   axios({
          //     method: 'post',
          //     url: '/manager/basedata/area/getAreaByLevel/1'
          //   })
          //   .then(function(data) {
          //     var _arr = []
          //     data.map(function(item) {
          //       var _obj = {}
          //       _obj.label = item.name
          //       _obj.value = item.id
          //       _arr.push(_obj)
          //     })
          //     that.countryOptions = _arr
          //   })
          //   .catch(function(err) {
          //     console.log(err, '获取国家数据时捕获异常')
          //   })
          // },
          // 获取省份数据
          getProvinceData: function(country) {
            var that = this
            axios({
              method: 'post',
              url: 'manager/basedata/area/getAreaByParentId/' + country
            })
            .then(function(data) {
                var _arr = []
                if (data.length > 0) {
                  data.map(function(item) {
                    var _obj = {}
                    _obj.label = item.name
                    _obj.value = item.id
                    _arr.push(_obj)
                  })
                  that.provinceOptions = _arr
                } else {
                  // _arr.push({
                  //   label: '无',
                  //   value: 'none'
                  // })
                  // that.provinceOptions = _arr
                }
            })
            .catch(function(err) {
              console.log(err, '获取省份数据时捕获异常')
            })
          },
          // 获取城市数据
          getCityData: function(province) {
            var that = this
            axios({
              method: 'post',
              url: '/manager/basedata/area/getAreaByParentId/' + province
            })
            .then(function(data) {
              var _arr = []
              if (data.length > 0) {
                data.map(function(item) {
                  var _obj = {}
                  _obj.label = item.name
                  _obj.value = item.id
                  _arr.push(_obj)
                })
                that.cityOptions = _arr
              } else {
                // _arr.push({
                //   label: '无',
                //   value: 'none'
                // })
                // that.cityOptions = _arr
              }
            })
            .catch(function(err) {
              console.log(err, '获取城市数据时捕获异常')
            })
          },
          // 获取科目组数据
          getSubjectGroupData: function() {
            var that = this
            axios({
              method: 'post',
              url: '/manager/basedata/dictGroup/getDictItemSelect/SUBJECT'
            })
            .then(function(data) {
                var _arr = []
                data.map(function(item) {
                  var _obj = {}
                  _obj.label = item.name
                  _obj.value = item.id
                  _arr.push(_obj)
                })
                that.subjectGroupOptions = _arr
            })
            .catch(function(err) {
              console.log(err, '获取科目组数据时捕获异常')
            })
          },
          // 获取公司代码数据
          getCodeData: function() {
            var that = this
            axios({
              method: 'post',
              url: '/manager/basedata/company/getCompany'
            })
            .then(function(data) {
                var _arr = []
                data.map(function(item) {
                  var _obj = {}
                  _obj.label = item.name
                  _obj.value = item.id + ''
                  _arr.push(_obj)
                })
                that.companyIdOptions = _arr
            })
            .catch(function(err) {
              console.log(err, '获取公司代码数据时捕获异常')
            })
          },
          openEditModal: function(mainDataStatus) {
            var that = this
            if (mainDataStatus != 0) {
              this.$refs['businessLic'].reset()
              axios({
                method: 'post',
                url: '/manager/new/vendor/baseInfoNew/vendorQueryVendorBaseInfo'
              })
              .then(function(data) {
                if (data.statusCode == 200) {
                  that.editForm.name = data.single.name,
                  that.editForm.taxId = data.single.taxId,
                  that.editForm.usefulTime = data.single.usefulTime,
                  that.editForm.sysFileName = data.single.sysFileName,
                  that.editForm.sysFileType = data.single.sysFileType,
                  that.editForm.fileUrl = data.single.fileUrl,
                  that.editForm.userFileName = data.single.userFileName,
                  that.editForm.userFileType = data.single.userFileType,

                  that.editNotAllowedForm = {
                    name: data.single.name,
                    taxId: data.single.taxId,
                    usefulTime: data.single.usefulTime,
                    sysFileName: data.single.sysFileName,
                    sysFileType: data.single.sysFileType,
                    fileUrl: data.single.fileUrl,
                    userFileName: data.single.userFileName,
                    userFileType: data.single.userFileType
                  }
                  if (data.single.fileUrl != null && data.single.userFileName != null) {
                    var _filename = encodeURI(encodeURIComponent(data.single.fileUrl.split('.')[0]))
                    that.downloadUrl = baseURL + '/common/download/' + _filename + '/' + data.single.fileUrl.split('.')[1]
                    that.downloadName = data.single.userFileName
                  } else {
                    that.downloadUrl = 'javascript:;'
                    that.downloadName = '暂无附件'
                  }
                  that.$v.editForm.$reset()
                  that.$v.editNotAllowedForm.$reset()
                  if (mainDataStatus == '1') {
                    that.editModal = true
                  } else {
                    that.editNotAllowedModal = true
                  }
                } else {
                  that.$q.notify({
                    message: that.$t(STATUS_CODE[data.statusCode]),
                    icon: 'error_outline',
                    type: 'negative',
                    position: 'top-right'
                  })
                }
              })
              .catch(function(err) {
                console.log(err)
              })
            } else {
              that.$q.notify({
                message: '已提交审核中，暂不能更改',
                icon: 'warning',
                type: 'warning',
                position: 'top-right'
              })
            }
          },
          // 文件上传完成
          uploaded: function(file, xhr) {
            var _fileRes = JSON.parse(xhr.response)
            this.editNotAllowedForm.sysFileName = _fileRes.sysFileName
            this.editNotAllowedForm.sysFileType = _fileRes.suffix
            this.editNotAllowedForm.fileUrl = _fileRes.path
            this.editNotAllowedForm.userFileName = _fileRes.name
            this.editNotAllowedForm.userFileType = _fileRes.suffix
          },
          uploaded1: function(file, xhr) {
            var _fileRes = JSON.parse(xhr.response)
            this.editForm.sysFileName = _fileRes.sysFileName
            this.editForm.sysFileType = _fileRes.suffix
            this.editForm.fileUrl = _fileRes.path
            this.editForm.userFileName = _fileRes.name
            this.editForm.userFileType = _fileRes.suffix
          },
          // 变更文件上传完成
          fileChangeUploaded: function(file, xhr) {
            var _fileRes = JSON.parse(xhr.response)
            this.editForm.sysFileNamex = _fileRes.sysFileName
            this.editForm.sysFileTypex = _fileRes.suffix
            this.editForm.fileUrlx = _fileRes.path
            this.editForm.userFileNamex = _fileRes.name
            this.editForm.userFileTypex = _fileRes.suffix
          },
          // 上部数据修改
          saveEditHandler: function() {
            var _flag 
            var _data = {}
            var that = this
            if (this.baseInfoForm.mainDataStatus == '1') {
              this.$v.editForm.$touch()
              _flag = !this.$v.editForm.$error
              _data = {
                id: this.currentSupplierId,
                name: this.editForm.name,
                taxId: this.editForm.taxId,
                sysFileName: this.editForm.sysFileName,
                sysFileType: this.editForm.sysFileType,
                fileUrl: this.editForm.fileUrl,
                userFileName: this.editForm.userFileName,
                userFileType: this.editForm.userFileType,
                usefulTime: this.editForm.usefulTime,
                sysFileNamex: this.editForm.sysFileNamex,
                sysFileTypex: this.editForm.sysFileTypex,
                fileUrlx: this.editForm.fileUrlx,
                userFileNamex: this.editForm.userFileNamex,
                userFileTypex: this.editForm.userFileTypex,
                usefulTimex: this.editForm.usefulTimex,
                col23: this.editForm.col23
              }
            } else {
              this.$v.editNotAllowedForm.$touch()
              _flag = !this.$v.editNotAllowedForm.$error
              _data = {
                id: this.currentSupplierId,
                name: this.editNotAllowedForm.name,
                taxId: this.editNotAllowedForm.taxId,
                sysFileName: this.editNotAllowedForm.sysFileName,
                sysFileType: this.editNotAllowedForm.sysFileType,
                fileUrl: this.editNotAllowedForm.fileUrl,
                userFileName: this.editNotAllowedForm.userFileName,
                userFileType: this.editNotAllowedForm.userFileType,
                usefulTime: this.editNotAllowedForm.usefulTime,
              }
            }
            if (_flag) {
              this.btnLoading = true
              axios({
                method: 'post',
                url: '/manager/new/vendor/baseInfoNew/upddateVendorBaseInfoMain',
                data: _data
              })
              .then(function(data) {
                if (data.statusCode == 200) {
                  that.$q.notify({
                    message: '编辑成功',
                    icon: 'done',
                    type: 'positive',
                    position: 'top-right'
                  })
                } else {
                  that.$q.notify({
                    message: that.$t(STATUS_CODE[data.statusCode]),
                    icon: 'error_outline',
                    type: 'negative',
                    position: 'top-right'
                  })
                }
                that.btnLoading = false
                that.editModal = false
                that.editNotAllowedModal = false
                that.getInfo()
              })
              .catch(function(err) {
                console.log(err)
              })
            }
          },
          focusOpenTree: function() {
            var that = this
            axios({
              method: 'post',
              url: '/manager/new/invitationToRegister/treeName/1000'
            })
            .then(function(data) {
              if (data.statusCode == 200) {
                if (data.rows == undefined || data.rows == null) {
                  data.rows = []
                } 
                that.meterialLevelData = data.rows
                that.meterialTreeModal = true
              } else {
                that.$q.notify({
                  message: that.$t(STATUS_CODE[data.statusCode]),
                  icon: 'error_outline',
                  type: 'negative',
                  position: 'top-right'
                })
              }
            })
            .catch(function(err) {
              console.log(err, '获取物料数据时捕获异常！')
            })
          },
          saveChooseMeterialHandler: function() {
            var that = this
            var _arr = []
            this.nodeTicked.map(function(item) {
              that.meterialLevelData.map(function(item2) {
                if (item == item2.value) {
                  _arr.push(item2.label)
                }
              })
            })
            this.baseInfoForm.col29 = _arr.join(',')
            this.baseInfoForm.col28 = this.nodeTicked.join(',')
            this.meterialTreeModal = false
          },
          // 基本信息修改
          saveEditBaseInfoHandler: function() {
            this.$v.baseInfoForm.$touch()
            var that = this
            if (!this.$v.baseInfoForm.$error) {
              var countryText = '', provinceText = '', cityText = ''
              this.countryOptions.map(function(item) {
                if (that.baseInfoForm.country == item.value) {
                  countryText = item.label
                }
              })
              this.provinceOptions.map(function(item) {
                if (that.baseInfoForm.province == item.value) {
                  provinceText = item.label
                }
              })
              this.cityOptions.map(function(item) {
                if (that.baseInfoForm.city == item.value) {
                  cityText = item.label
                }
              })
              this.btnLoading = true
              axios({
                method: 'post',
                url: '/manager/new/vendor/baseInfoNew/upddateVendorBaseInfoBasics',
                data: {
                  id: this.currentSupplierId,
                  legalPerson: this.baseInfoForm.legalPerson, 
                  col24: this.baseInfoForm.col24,      
                  col25: this.baseInfoForm.col25,      
                  col26: this.baseInfoForm.col26,      
                  duns: this.baseInfoForm.duns,      
                  property: this.baseInfoForm.property,      
                  vendorClassify: this.baseInfoForm.vendorClassify,       // 科目组
                  // subjectGroupId: this.baseInfoForm.subjectGroupId,       // 科目组
                  companyId: this.baseInfoForm.companyId.join(','),            // 公司代码
                  country: this.baseInfoForm.country,              // 国家
                  countryText: countryText,
                  province: this.baseInfoForm.province,             // 省份
                  provinceText: provinceText,
                  city: this.baseInfoForm.city,                 // 城市
                  cityText: cityText,
                  address: this.baseInfoForm.address,              // 街道
                  email: this.baseInfoForm.email,              // 邮箱
                  shortName: this.baseInfoForm.shortName,      // 企业简称
                  postCode: this.baseInfoForm.postCode,             // 邮编
                  phone: this.baseInfoForm.phone,                // 电话
                  mobilePhone: this.baseInfoForm.mobilePhone,          // 手机
                  fax: this.baseInfoForm.fax,                  // 传真
                  contacts: this.baseInfoForm.contacts,             // 联系人
                  postCode: this.baseInfoForm.postCode,             // 邮编
                  managerContact: this.baseInfoForm.managerContact,       // 总经理联系人
                  managerTelephone: this.baseInfoForm.managerTelephone,     // 总经理联系电话
                  salesDirector: this.baseInfoForm.salesDirector,         // 销售总监联系人
                  salesDirectorTelephone: this.baseInfoForm.salesDirectorTelephone,// 销售总监联系电话
                  col28: this.baseInfoForm.col28,
                  col29: this.baseInfoForm.col29,
                }
              })
              .then(function(data) {
                if (data.statusCode == 200) {
                  that.$q.notify({
                    message: '编辑成功',
                    icon: 'done',
                    type: 'positive',
                    position: 'top-right'
                  })
                  that.readonly = true
                  that.isEdit = true
                  that.isSubmit = false
                } else {
                  that.$q.notify({
                    message: that.$t(STATUS_CODE[data.statusCode]),
                    icon: 'error_outline',
                    type: 'negative',
                    position: 'top-right'
                  })
                }
                that.getInfo()
                that.btnLoading = false
              })
              .catch(function(err) {
                console.log(err)
              })
            }
          },
          clickEdit: function(basicsDataStatus) {
              this.$v.baseInfoForm.$reset() 
              this.readonly = false
              this.isEdit = false
              this.isSubmit = true
          },
          questionChange: function() {
            this.questionAllOptions = []
            var that = this
            this.questionList.map(function(item) {
              item.csdata.map(function(question) {
                if (question.taskStatus == 1) {
                  var _obj = {}
                  _obj.label = question.name
                  _obj.value = question.id
                  that.questionAllOptions.push(_obj)
                }
              })
            })
            this.questionChangeModal = true
          },
          questionChangeConfirm: function() {
            var that = this
            this.$v.questionChangeForm.$touch()
            if (!this.$v.questionChangeForm.$error) {
              this.btnLoading = true
              axios({
                method: 'post',
                url: '/manager/new/vendor/baseInfoNew/initiatingAChange?tx=1',
                data: {
                  ids: this.questionChangeForm.questionIds.join(','),
                  orgId: this.orgId
                }
              })
              .then(function(data) {
                if (data.statusCode == 200) {
                  that.$q.notify({
                    message: '操作成功',
                    type: 'positive',
                    icon: 'done',
                    position: 'top-right'
                  })
                } else if (data.statusCode == 201) {
                  that.$q.notify({
                    message: '部分操作成功',
                    type: 'positive',
                    icon: 'done',
                    position: 'top-right'
                  })
                } else {
                  that.$q.notify({
                    message: that.$t(STATUS_CODE[data.statusCode]),
                    icon: 'error_outline',
                    type: 'negative',
                    position: 'top-right'
                  })
                }
                that.btnLoading = false
                that.questionChangeModal = false
                that.getQuestionList()
              })
              .catch(function(err) {
                console.log(err)
              })
            }
          }
        }
      })
    </script>
  </body>
</html>